<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>



<?
$nav_id = $_REQUEST ['id'];
$detail    = select_one_line_all_items($table_Prefix."nav","id='".$nav_id."'");
$nav_list = select_lines_all_items($table_Prefix."plate",' nid desc ');
?>


<body>

<!--顶部栏-->
<div id="topbar"> <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?></div>

<!--容器-->
<div id="container" class="<? echo $now_extender ?>">

    <!--侧边栏-->
    <div id="sidebar"><?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?></div>





    <?
    //==============================================================================
    //这里开始才是平常开发需要注重的部分，其余的基本不用理会
    //==============================================================================
    ?>


<div id="content">

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend><h1>自定义导航详情</h1></legend>
    </fieldset>

<div class="detail-box">


<ul>
<form id="detail_form" class="layui-form  layui-form-pane" method="post" action="detail-edit-function.php" enctype="multipart/form-data" name="uploadfile">





<li class="layui-form-item">
<label class="layui-form-label">系统内容：</label>
    <div class="layui-input-block">
        <select lay-filter="nav" name="menulist" id="menulist">
            <option value='-'>-</option>
            <?php foreach($nav_list as $key=>$value){?>
                <option value='<?php echo $key;?>' <?if ($key == $detail['menulist']) echo 'selected="selected"';?> ><?php echo $value['name'];?></option>
            <?php }?>
        </select>
    </div>

   
</li>

<li class="layui-form-item">
<label class="layui-form-label">名称：</label>
<div class="layui-input-block">
	<input class="layui-input" type="text" name="ai_name" value="<?php echo $detail['name']?>" id="item_name" size="40" onKeyPress="javascript:key();" />
</div>
  
</li>


<li class="layui-form-item">
<label class="layui-form-label">链接地址：</label>
<div class="layui-input-block">
	<input class="layui-input" type="text" name="ai_url" value="<?php echo $detail['url']?>" id="item_url" size="40" onKeyPress="javascript:key();" />
</div>
    <em class="explain"></em>


</li>

<li class="layui-form-item">
<label class="layui-form-label">排序：</label>
<div class="layui-input-block">
	<input class="layui-input" type="text" name="ai_vieworder" value="<?php echo $detail['vieworder']?>" size="40" />
</div>
    <em class="explain"></em>


</li>
<li class="layui-form-item">
<label class="layui-form-label">是否显示：</label>
<div class="layui-input-block">
    <select name="ai_ifshow">
      <option value='1' <?php echo $detail['ifshow'] == 1 ? 'selected="selected"' : ''?>  >是</option><option value='0' <?php echo $detail['ifshow'] == 0 ? 'selected="selected"' : ''?> >否</option>
    </select>
</div>
    <em class="explain"></em>


</li>

<li class="layui-form-item">
<label class="layui-form-label">是否新窗口：</label>
<div class="layui-input-block">
	<select name="ai_opennew">
    	<option value='0' <?php echo $detail['opennew'] == 0 ? 'selected="selected"' : ''?> >否</option>
    	<option value='1' <?php echo $detail['opennew'] == 1 ? 'selected="selected"' : ''?>  >是</option>
  	
  	</select></div>
    <em class="explain"></em>


</li>

<li class="layui-form-item">
<label class="layui-form-label">位置：</label>
<div class="layui-input-block">
	<select name="ai_type">
  		<option value='top'  <?php echo $detail['type'] == 'top' ? 'selected="selected"' : ''?>>顶部</option>
        <option value='middle' <?php echo $detail['type'] == 'middle' ? 'selected="selected"' : ''?>>中间</option>
        <option value='bottom' <?php echo $detail['type'] == 'bottom' ? 'selected="selected"' : ''?>>底部</option>
  	</select>	

</div>
    <em class="explain"></em>


</li>

<li class="layui-form-item">
    <label class="layui-form-label">ICON：</label><img src="../../uploadfiles/<? echo $theme_folder ?>/<? echo $detail['icon'] ?>"
                                                      width="100"/></li>
<li class="layui-form-item">
    <label class="layui-form-label">上传文件：</label><input type="file" name="icon"
                                                        onchange="fileChange(this);"/><em
        class="explain">(上传导航icon图片)</em></li>
    <hr/>

		<div class="function">
        	<input type="hidden"  name="ai_id" value="<?php echo $detail['id']?>" />
            
			<input type="submit" class="layui-btn"  value="确认" />
			<input type="button" class="layui-btn"  value="取消" />
		</div>
</form>
</ul>

</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat" />
</div>
<!--container端點01-->
</div>
<script type="text/javascript">
var last;
function add_main(key)
{
	
    var sysm = new Object;
    <?php 
	foreach($nav_list as $key => $val){
	?>
      sysm[<?php echo $key;?>] = new Array();
        sysm[<?php echo $key;?>][0] = '<?php echo $val['name']?>';
        sysm[<?php echo $key;?>][1] = '<?php echo $val['url']?>.html';
    <?php 
	}
	?>
    if (key != '-')
    {
        if(sysm[key][0] != '-')
        {
            document.getElementById('item_name').value = sysm[key][0];
            document.getElementById('item_url').value = sysm[key][1];
            last = document.getElementById('menulist').selectedIndex;
        }
        else
        {
            if(last < document.getElementById('menulist').selectedIndex)
            {
                document.getElementById('menulist').selectedIndex ++;
            }
            else
            {
                document.getElementById('menulist').selectedIndex --;
            }
            last = document.getElementById('menulist').selectedIndex;
            document.getElementById('item_name').value = sysm[last-1][0];
            document.getElementById('item_url').value = sysm[last-1][1];
        }
    }
    else
    {
        last = document.getElementById('menulist').selectedIndex = 1;
        document.getElementById('item_name').value = sysm[last-1][0];
        document.getElementById('item_url').value = sysm[last-1][1];
    }
}
function key()
{
    last = document.getElementById('menulist').selectedIndex = 0;
}

layui.use('form', function(){
  var form = layui.form;
  
  form.on('select(nav)', function(data){
     add_main(data.value)
  });
});

          
</script>


<!--底部栏-->
<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>




</body>
</html>
